#!/usr/bin/env python

import logging

# 
class debug(logging.Handler):
   def __init__(self,chatWindow,jid):
      logging.Handler.__init__(self);
      self.setLevel(logging.INFO);
      self.chatWindow = chatWindow;
      self.jid = jid;
      

   def handle(self,record):
      format = logging.Formatter();
      st = format.format(record) + "\n";
      conv = self.chatWindow.convs.getByJID(self.jid);
      buf = conv.view.get_buffer();
      eIter = buf.get_end_iter()
      buf.insert(eIter,st);
      
      mark = buf.get_mark('end');
      conv.view.scroll_to_mark(mark,0.05,True,0.0,1.0);


   def filter(self,record):
      return True;

#